require 'test/unit'
require 'minitest/spec'
require 'mocha/setup'
require 'tweetabout'

tw = TweetAbout::TweetWords.new("jack")

describe "the defaults" do
  response = tw.sort_words(:tweets => 5)

  it "should be an instance of TweetWords" do
    assert_equal TweetAbout::TweetWords, tw.class
  end

  it "should be successful and should be an Array" do
    assert_equal :ok, response.status
    assert_equal Array, response.words.class
  end
end

describe "the {:with_count => true} option" do
  response = tw.sort_words(:with_count => true, :tweets => 5)
  words = response.words

  it "should be successful and should be a Hash" do
    assert_equal :ok, response.status
    assert_equal TweetAbout::WordsHash, words.class
  end
end

describe ":with_count option" do
  it "should handle with count true" do
    response = tw.sort_words(:with_count => true, :tweets => 5)
    assert_equal :ok, response.status
  end

  it "should handle with count false" do
    response = tw.sort_words(:with_count => false, :tweets => 5)
    assert_equal :ok, response.status
  end
end

describe "a number string to tweets should work" do
  it "should handle a number string for tweets" do
    response = tw.sort_words(:tweets => "5")
    assert_equal :ok, response.status
  end
end

describe "include_rts options should work" do
  it "should handle include rts true" do
    response = tw.sort_words(:include_rts => true)
    assert_equal :ok, response.status
  end

  it "should handle include rts true" do
    response = tw.sort_words(:include_rts => false)
    assert_equal :ok, response.status
  end
end